
import request from '@/utils/request'

/**
 * 获取人员列表
 */
export const getPeopleAPI = (params) => {
  return request.get('/user-service/user/search', { params })
}
// 新增人员
export const addPeopleAPI = (data) => {
  return request.post('/user-service/user', data)
}

/**
 * 获取角色列表
 */
export const getRolesAPI = () => {
  return request.get('/user-service/role')
}

/**
 * 获取区域列表
 */
export const getAreasAPI = (params) => {
  return request({ url: '/vm-service/region/search', params: {
    pageIndex: 1,
    pageSize: 10000
  }})
}

/**
 * 图片上传
 */
export const imageSave = (formData) => {
  return request.post('/vm-service/sku/fileUpload', formData)
}

/**
 * 删除人员
 */
export const deletePeopleAPI = (id) => {
  return request.delete('/user-service/user/' + id)
}
/**
 * 编辑角色
 */
export const editPeopleAPI = (id) => {
  return request.get('/user-service/user/' + id)
}

/**
 * 修改人员通过id
 */
export const editRoleByIdAPI = (data) => {
  return request({ url: `/user-service/user/${data.userId}`, method: 'put', data })
}

/**
 * 获取人员列表
 */
export const getSearchPeopleAPI = (searchName) => {
  return request({ url: '/user-service/user/search', params: { pageIndex: 1, pageSize: 10000, userName: searchName }})
}
